CREATE TABLE [dbo].[LicenseMapMaster]
(
[LicenseKey] [uniqueidentifier] NOT NULL,
[LicenseType] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreatedByUserKey] [uniqueidentifier] NOT NULL,
[CreatedOn] [datetime] NOT NULL,
[UpdatedByUserKey] [uniqueidentifier] NOT NULL,
[UpdatedOn] [datetime] NOT NULL,
[MarkedForDeleteOn] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[LicenseMapMaster] ADD CONSTRAINT [PK_LicenseMapMaster] PRIMARY KEY CLUSTERED ([LicenseKey], [LicenseType]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_LicenseMapMaster_CreatedByUserKey] ON [dbo].[LicenseMapMaster] ([CreatedByUserKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_LicenseMapMaster_UpdatedByUserKey] ON [dbo].[LicenseMapMaster] ([UpdatedByUserKey]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[LicenseMapMaster] ADD CONSTRAINT [FK_LicenseMapMaster_License] FOREIGN KEY ([LicenseKey]) REFERENCES [dbo].[License] ([LicenseKey])
GO
ALTER TABLE [dbo].[LicenseMapMaster] ADD CONSTRAINT [FK_LicenseMapMaster_LicenseTypeRef] FOREIGN KEY ([LicenseType]) REFERENCES [dbo].[LicenseTypeRef] ([LicenseType])
GO
ALTER TABLE [dbo].[LicenseMapMaster] ADD CONSTRAINT [FK_LicenseMapMaster_UserMain_CreatedBy] FOREIGN KEY ([CreatedByUserKey]) REFERENCES [dbo].[UserMain] ([UserKey])
GO
ALTER TABLE [dbo].[LicenseMapMaster] ADD CONSTRAINT [FK_LicenseMapMaster_UserMain_UpdatedBy] FOREIGN KEY ([UpdatedByUserKey]) REFERENCES [dbo].[UserMain] ([UserKey])
GO